#include <cstdio>
int count[128] = {0};
char map[] = "PATest";
int main()
{
    char c;
    while ((c = getchar()) != '\n')
    {
        count[c]++;
    }
    bool flag = true; //用于判断当前轮次是否有输出
    int i;
    while (flag)
    {
        flag = false;
        for (i = 0; i < 6; ++i)
        {
            if(count[map[i]]  > 0)
            {
                flag =true;
                putchar(map[i]);
                count[map[i]]--;
            }
        }
    }
    putchar(10);
    return 0;
}